home *** CD-ROM | disk | FTP | other *** search
/ Developer CD Series 1997 July: Mac OS SDK / Dev.CD Jul 97 SDK1.toast / Development Kits (Disc 1) / QuickDraw GX / Programming Stuff / Sample Code / Printing Samples / Extensions… / "kabooms" (global data info) ƒ / kaboom ƒ / kaboom.c < prev    next >
Encoding:
C/C++ Source or Header  |  1996-06-14  |  1.4 KB  |  80 lines  |  [TEXT/MPS ]

  1. /*    File: kaboom.c
  2.     
  3.     C code for a simple printing extension.
  4.     
  5.     Dave Hersey
  6.     Apple Developer Technical Support
  7.  
  8.     2/01/93 - dmh - Created.
  9.     4/26/93 - dmh - Modified to work around b1 shutdown bug.
  10.     9/07/93 - dmh - Updated for b2.
  11.    12/18/93 - dmh - Updated for b3.
  12.     3/22/94 - dmh - Verified for b4.
  13.     6/14/96 - cn  - Updated to support Universal Interfaces 2.1.
  14. */
  15.  
  16. #include <Types.h>
  17. #include <Errors.h>
  18. #include <Resources.h>
  19. #include <ToolUtils.h>
  20. #include <GXMessages.h>
  21. #include <GXPrinting.h>
  22.  
  23. // external defines for creating our A5 world.
  24.  
  25. extern long A5Size (void);
  26. extern void A5Init (void *);
  27.  
  28.  
  29. #define r_str        200
  30. #define r_s1_idx    1
  31. #define r_s2_idx    2
  32. #define r_s3_idx    3
  33. #define r_s4_idx    4
  34.  
  35. // globals
  36.  
  37. Str255    s1;
  38. Str255    s2;
  39. Str255    s3;
  40. Str255    s4;
  41.  
  42. OSErr MyStartJob(StringPtr docName, long pageCount)
  43. {
  44.     short    oldResFile;
  45.     OSErr    err1, err2;
  46.  
  47.     NewMessageGlobals(A5Size(), A5Init);
  48.     
  49.     oldResFile = CurResFile();
  50.     UseResFile(GXGetMessageHandlerResFile());
  51.  
  52.     GetIndString(s1, r_str, r_s1_idx);
  53.     GetIndString(s2, r_str, r_s2_idx);
  54.     GetIndString(s3, r_str, r_s3_idx);
  55.     GetIndString(s4, r_str, r_s4_idx);
  56.  
  57.     err1 = ResError();
  58.     err2 = Forward_GXStartJob(docName, pageCount);
  59.     
  60.     if(!err2) err2 = err1;
  61.     
  62.     if (err2)
  63.         DisposeMessageGlobals();
  64.  
  65.     UseResFile(oldResFile);
  66.     return err1;
  67. }
  68.  
  69.  
  70. OSErr MyFinishJob()
  71. {
  72.     DebugStr(s1);
  73.     DebugStr(s2);
  74.     DebugStr(s3);
  75.     DebugStr(s4);
  76.     
  77.     DisposeMessageGlobals();
  78.     return Forward_GXFinishJob();
  79. }
  80.